libxl: Rationalise #includes
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 12 Dec 2011 17:48:40 +0000 (17:48 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Mon, 12 Dec 2011 17:48:40 +0000 (17:48 +0000)
libxl_internal.h now #includes libxl.h and various system headers.

This
 1. makes the order of header inclusion more predictable
 2. explicitly allows libxl_internal.h to use objects defined in libxl.h
 3. removes the need for individual files to include these headers

Also
 - remove some unnecessary #includes of libxl_utils.h,
   flexarray.h, etc. in some libxl*.c files,
 - include libxl_osdeps.h at the top of libxl_internal.h
 - add missing includes of libxl_osdeps.h to a couple of files
 - change libxl.h to libxl_internal.h in a couple of files

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
21 files changed:
tools/libxl/libxl.c
tools/libxl/libxl_blktap2.c
tools/libxl/libxl_bootloader.c
tools/libxl/libxl_cpuid.c
tools/libxl/libxl_create.c
tools/libxl/libxl_device.c
tools/libxl/libxl_dm.c
tools/libxl/libxl_dom.c
tools/libxl/libxl_exec.c
tools/libxl/libxl_flask.c
tools/libxl/libxl_internal.c
tools/libxl/libxl_internal.h
tools/libxl/libxl_json.c
tools/libxl/libxl_noblktap2.c
tools/libxl/libxl_nocpuid.c
tools/libxl/libxl_paths.c
tools/libxl/libxl_pci.c
tools/libxl/libxl_qmp.c
tools/libxl/libxl_utils.c
tools/libxl/libxl_uuid.c
tools/libxl/libxl_xshelp.c

index b268f485a2b3f00aaf685e454a9eee873a9f4b0d..e5cadb2c0a7ad1a008868e6952515712c685fd5d 100644 (file)
 #include <inttypes.h>
 #include <assert.h>
 
-#include "libxl.h"
-#include "libxl_utils.h"
 #include "libxl_internal.h"
-#include "flexarray.h"
 
 #define PAGE_TO_MEMKB(pages) ((pages) * 4)
 #define BACKEND_STRING_SIZE 5
index c8d9148c657f0526c71e1f88bf08ab70e7d028cc..acf4110ea82611061b7e2884c17d0dcacb623873 100644 (file)
@@ -12,7 +12,6 @@
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl.h"
 #include "libxl_osdeps.h"
 #include "libxl_internal.h"
 
index 47bb3a1bcf474d17b96c87b8c0260e3df8ab74d4..b8399a1cb56a8f7bfce2870248ae55240558923e 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "libxl_osdeps.h"
 
-#include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <termios.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
-#include "libxl.h"
 #include "libxl_internal.h"
 
-#include "flexarray.h"
-
 #define XENCONSOLED_BUF_SIZE 16
 #define BOOTLOADER_BUF_SIZE 4096
 #define BOOTLOADER_TIMEOUT 1
index 78bcab509fc5e869d9091242ca3b1bd52c21d62a..56a00cdf382c7fcb2bdc6940f00b8c23bc4c6c61 100644 (file)
  * GNU Lesser General Public License for more details.
  */
 
-#include <string.h>
-
-#include "libxl.h"
-#include "libxl_osdeps.h"
 #include "libxl_internal.h"
 
 void libxl_cpuid_dispose(libxl_cpuid_policy_list *p_cpuid_list)
index 648615600c1e98ee82489821416398ca8a4b4d07..d640b14eaf9bfd925042c316c1b792d6dc42bac7 100644 (file)
 #include <xc_dom.h>
 #include <xenguest.h>
 #include <assert.h>
-#include "libxl.h"
-#include "libxl_utils.h"
+
 #include "libxl_internal.h"
-#include "flexarray.h"
 
 void libxl_domain_config_dispose(libxl_domain_config *d_config)
 {
index 1db395c116b25d7c5115e034c338a40f8a6a66d6..5969ae32ceeeb9aab597e5752719d50bbb8a8c51 100644 (file)
@@ -24,7 +24,6 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-#include "libxl.h"
 #include "libxl_internal.h"
 
 char *libxl__device_frontend_path(libxl__gc *gc, libxl__device *device)
index 038feabcd4a9509d7acd0e9b31436e8302d6fcfa..808f70eef8bdd859f1f54ca28fa212e9d200f970 100644 (file)
 #include <unistd.h>
 #include <fcntl.h>
 #include <assert.h>
-#include "libxl_utils.h"
+
 #include "libxl_internal.h"
-#include "libxl.h"
-#include "flexarray.h"
 
 static const char *libxl_tapif_script(libxl__gc *gc)
 {
index d0417236a92ab731e03075e27feb59538647ed5b..0044cc35e56074b77014c977ee9dbabc92cf5da5 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <xen/hvm/hvm_info_table.h>
 
-#include "libxl.h"
 #include "libxl_internal.h"
 
 libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid)
index 1a62d475b493dbbcfee9e65d705b5628d25c7bc8..52d40d13a01b5be0125f29eda0db6b2149dc1c51 100644 (file)
@@ -28,7 +28,6 @@
 #include <signal.h> /* for SIGKILL */
 #include <fcntl.h>
 
-#include "libxl.h"
 #include "libxl_internal.h"
 
 static int call_waitpid(pid_t (*waitpid_cb)(pid_t, int *, int), pid_t pid, int *status, int options)
index c8d05941699ee4f416422b8dea39fa1789968613..6b548dd727d0d597eb78f2415697fab7c9814567 100644 (file)
@@ -7,13 +7,14 @@
  *  as published by the Free Software Foundation.
  */
 
+#include "libxl_osdeps.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
 #include <xenctrl.h>
 
-#include "libxl.h"
 #include "libxl_internal.h"
 
 int libxl_flask_context_to_sid(libxl_ctx *ctx, char *buf, size_t len,
index 028f90f74ba807346c0318b840255668df5ada47..aafd2bb4f12efb5d6147d0e0249e0c02b3442baf 100644 (file)
@@ -16,8 +16,6 @@
 #include "libxl_osdeps.h"
 
 #include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -25,9 +23,7 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
-#include "libxl.h"
 #include "libxl_internal.h"
-#include "libxl_utils.h"
 
 int libxl__error_set(libxl__gc *gc, int code)
 {
index bab6f62503ae10ac376acde1bb85181b75532466..e66b86a08156bd886cf98b3be0ccaab154c10378 100644 (file)
 #ifndef LIBXL_INTERNAL_H
 #define LIBXL_INTERNAL_H
 
+#include "libxl_osdeps.h"
+
 #include <stdint.h>
 #include <stdarg.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <xs.h>
 #include <xenctrl.h>
 #include "xentoollog.h"
 
+#include "libxl.h"
+
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
 #define _hidden __attribute__((visibility("hidden")))
 #define _protected __attribute__((visibility("protected")))
index fd5e2aac46104b57acc26b4bcb4d481c8cc5169c..c0f869e1eb06a8d0abd5ba5218e03956f165f709 100644 (file)
@@ -12,6 +12,8 @@
  * GNU Lesser General Public License for more details.
  */
 
+#include "libxl_osdeps.h"
+
 #include <assert.h>
 #include <string.h>
 #include <math.h>
@@ -19,7 +21,6 @@
 #include <yajl/yajl_parse.h>
 #include <yajl/yajl_gen.h>
 
-#include <libxl.h>
 #include "libxl_internal.h"
 
 /* #define DEBUG_ANSWER */
index 704d03fbff80dca05d9e0ac136645336a9c793e4..3307551b2cec0f5d1b50705758c5fc7111aa6019 100644 (file)
@@ -12,8 +12,6 @@
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl.h"
-#include "libxl_osdeps.h"
 #include "libxl_internal.h"
 
 int libxl__blktap_enabled(libxl__gc *gc)
index d63757f3977ded9d5a8e759e536a08a4e386bd3f..2e9490cd1ca9a0dcb2235ce3acb9e78edec33954 100644 (file)
@@ -10,7 +10,7 @@
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl.h"
+#include "libxl_internal.h"
 
 void libxl_cpuid_destroy(libxl_cpuid_policy_list *p_cpuid_list)
 {
index c84e51da0d71da4d04adb859f0cbecf684156989..e7bd1a25fedaacadbf96391503cfa3dbbf975a18 100644 (file)
@@ -12,7 +12,7 @@
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl.h"
+#include "libxl_internal.h"
 #include "_libxl_paths.h"
 
 const char *libxl_sbindir_path(void)
index 4186cf816c8af8832ff7aef94a4206c1238bd143..63c30507f82ccb1ae2f782d3f3ea6a01e0a9b51a 100644 (file)
@@ -17,7 +17,6 @@
 #include "libxl_osdeps.h"
 
 #include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <signal.h>
 #include <unistd.h> /* for write, unlink and close */
-#include <stdint.h>
 #include <inttypes.h>
 #include <dirent.h>
 #include <assert.h>
 
-#include "libxl.h"
-#include "libxl_utils.h"
 #include "libxl_internal.h"
-#include "flexarray.h"
 
 #define PCI_BDF                "%04x:%02x:%02x.%01x"
 #define PCI_BDF_SHORT          "%02x:%02x.%01x"
index 4bc0dc87ae15d98e65eb3fe67f367d2a59521df9..4e3c64a774e62412facac57022caf4fc6dd1aeb0 100644 (file)
@@ -18,6 +18,8 @@
  * Specification, see in the QEMU repository.
  */
 
+#include "libxl_osdeps.h"
+
 #include <unistd.h>
 #include <sys/un.h>
 #include <sys/queue.h>
index 1fa2c0fb2c05f074b99848f9094d7f667eed4bf3..f1f2a6d6b6a2060505014cea8e7981a34642361e 100644 (file)
@@ -28,7 +28,6 @@
 #include <unistd.h>
 #include <assert.h>
 
-#include "libxl_utils.h"
 #include "libxl_internal.h"
 
 struct schedid_name {
index e83722871330fdbcc73e48a087bb9b0c42960eea..80ab789c8f07ee4a240bb371a29c20b93bee2e9e 100644 (file)
  * GNU Lesser General Public License for more details.
  */
 
+#include "libxl_osdeps.h"
+
 #include <libxl_uuid.h>
 
+#include "libxl_internal.h"
+
 #if defined(__linux__)
 
 int libxl_uuid_is_nil(libxl_uuid *uuid)
index bc4e7e4c7f1394b9975188572bab95f8c8ef2685..ea835e26a89c8f7d413ab4c7aa77eac7d7cfd15b 100644 (file)
@@ -21,7 +21,6 @@
 #include <stdarg.h>
 #include <inttypes.h>
 
-#include "libxl.h"
 #include "libxl_internal.h"
 
 char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array, int length)